from likeshop_api_project.base.mybase import Tools


# 获取商品列表
class get_shop_list_model(Tools):
    path = '/api/goods/getGoodsList'

    def shop_list_action(self, category_id, keyword, sales_sum, price):
        shop_list_data = {
            "category_id": category_id,
            "keyword": keyword,
            "sales_sum": sales_sum,
            "price": price
        }
        shop_list = self.huihua.get(url=self.hosturl+self.path, params=shop_list_data)
        return shop_list.json()


if __name__ == '__main__':
    import requests

    s = requests.session()
    shop_list = get_shop_list_model(huihua=s)
    msg = shop_list.shop_list_action(category_id='', keyword='', sales_sum='', price='')
    print(msg)
    commodity_id = msg["data"]["list"][0]["id"]
    print(commodity_id)
    hd = {"id": commodity_id}

